﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlcoKinect
{
    class SoundPlayer : ThreadStaticAttribute
    {
        System.Media.SoundPlayer player; 
        bool isSoundPlaying;

        public SoundPlayer (String name) {
            player = new System.Media.SoundPlayer();
            player.SoundLocation = name;
            player.Load();
            isSoundPlaying = false;
        }

        public void PlaySound() {
            if (!isSoundPlaying)
            {
                isSoundPlaying = true;
                player.PlaySync();
                isSoundPlaying = false;
            }
        }

        public bool IsPlaying()
        {
            return isSoundPlaying;
        }
    }
}